package com.arpa.wms.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Digits;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 出货单明细
 * </p>
 *
 * @author LEO
 * @since 2020-08-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wms_delivery_item")
@ApiModel(value="DeliveryItem对象", description="出货单明细")
public class DeliveryItem extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据标识")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "所属机构")
    @TableField("group_code")
    private String groupCode;

    @ApiModelProperty(value = "出库单号")
    @TableField("delivery_code")
    private String deliveryCode;

    @ApiModelProperty(value = "来源单明细标识,便于回填信息")
    @TableField("source_item_code")
    private String sourceItemCode;

    @ApiModelProperty(value = "商品编码code")
    @TableField("goods_code")
    private String goodsCode;

    @ApiModelProperty(value = "商品编码")
    @TableField("good_code")
    private String goodCode;

    @ApiModelProperty(value = "商品名称")
    @TableField("goods_name")
    private String goodsName;

    @ApiModelProperty(value = "商品条码")
    @TableField("goods_bar_code")
    private String goodsBarCode;

    @ApiModelProperty(value = "商品规格")
    @TableField("spec")
    private String spec;

    @ApiModelProperty(value = "保质期（天）")
    @TableField("expiration_quantity")
    private BigDecimal expirationQuantity;

    @ApiModelProperty(value = "单位")
    @TableField("goods_unit")
    private String goodsUnit;

    @ApiModelProperty(value = "单位名称")
    @TableField("goods_unit_name")
    private String goodsUnitName;

    @ApiModelProperty(value = "基本单位")
    @TableField("basic_unit")
    private String basicUnit;

    @ApiModelProperty(value = "基本单位名称")
    @TableField("basic_unit_name")
    private String basicUnitName;

    @ApiModelProperty(value = "版本号")
    @TableField("version")
    @Version
    private Integer version;

    @ApiModelProperty(value = "数量（销售单位）")
    @TableField("quantity")
    @Digits(integer = 14,fraction = 6, message = "明细数量超过了允许范围（只允许14位整数和6位小数范围内）", groups = {Delivery.Save.class, Delivery.Update.class})
    private BigDecimal quantity;

    @ApiModelProperty(value = "数量（基本单位）")
    @TableField("total_num")
    private BigDecimal totalNum;

    @ApiModelProperty(value = "实际分配数量（基本单位）")
    @TableField("distribution_quantity")
    private BigDecimal distributionQuantity;

    @ApiModelProperty(value = "拣货数量（基本单位）")
    @TableField("picking_quantity")
    private BigDecimal pickingQuantity;

    @ApiModelProperty(value = "已退货数量（销售单位）")
    @TableField("refund_quantity")
    private BigDecimal refundQuantity;

    @ApiModelProperty(value = "取消数量")
    @TableField(exist = false)
    private BigDecimal cancelQuantity;

    @ApiModelProperty(value = "出库数量（基本单位）")
    @TableField("outbound_quantity")
    private BigDecimal outboundQuantity;

    @ApiModelProperty(value = "出库数量（销售单位）")
    @TableField("outbound_unit_quantity")
    private BigDecimal outboundUnitQuantity;

    @ApiModelProperty(value = "基本单位转换数量")
    @TableField("basic_quantity")
    private BigDecimal basicQuantity ;

    @ApiModelProperty(value = "状态,0-新增。1-待分配，2-部分分配，3-已分配，101-已作废")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 100, message = "明细备注长度不能大于100个字符", groups = {Delivery.Save.class, Delivery.Update.class})
    private String remarks;

    @ApiModelProperty(value = "oms销售单明细code，冗余，待废弃")
    @TableField("sale_item_code")
    private String saleItemCode;

    @ApiModelProperty(value = "库存批次号，冗余，待废弃")
    @TableField("lot")
    private String lot;

    @ApiModelProperty(value = "收货批次，冗余，待废弃")
    @TableField("receive_lot")
    private String receiveLot;

    @ApiModelProperty(value = "库存状态，冗余，待废弃")
    @TableField("goods_status")
    private String goodsStatus;


    @ApiModelProperty(value = "分配库位，冗余，待废弃")
    @TableField("location")
    private String location;

    @ApiModelProperty(value = "生产日期，冗余，待废弃")
    @TableField("gmt_manufacture")
    private LocalDateTime gmtManufacture;

    @ApiModelProperty(value = "过期日期，冗余，待废弃")
    @TableField("gmt_expire")
    private LocalDateTime gmtExpire;

    @ApiModelProperty(value = "存货日期，冗余，待废弃")
    @TableField("gmt_stock")
    private LocalDateTime gmtStock;

    @ApiModelProperty(value = "计划数量")
    @TableField("plan_quantity")
    private BigDecimal planQuantity;

    @ApiModelProperty(value = "波次单号")
    @TableField("wave_picking_code")
    private String wavePickingCode;

    @ApiModelProperty(value = "实际价格")
    @TableField("actual_price")
    private BigDecimal actualPrice;

    @ApiModelProperty(value = "复核数量")
    @TableField("recheck_quantity")
    private BigDecimal recheckQuantity;

    @ApiModelProperty(value = "拣货缺货数量")
    @TableField("pick_stock_out_num")
    private BigDecimal pickStockOutNum;

    @ApiModelProperty(value = "复核缺货数量")
    @TableField("recheck_refund_quantity")
    private BigDecimal recheckRefundQuantity;


    @ApiModelProperty(value = "库存状态，数据库字段待废弃，实体类保留")
    @TableField(exist = false)
    private String goodsStatusName;

    @ApiModelProperty(value = "未复核数量")
    @TableField("not_recheck_quantity")
    private BigDecimal notRecheckQuantity;

    /**
     * 订单排序
     */
    @ApiModelProperty(value = "订单排序")
    @TableField("order_num")
    private Integer orderNum;

    /**
     * 订单排序
     */
    @ApiModelProperty(value = "交易平台订单")
    @TableField("source_order_code")
    private String sourceOrderCode;

    @ApiModelProperty(value = "包裹数量")
    @TableField(exist = false)
    private Integer planPackQuantity;

    @ApiModelProperty(value = "打包数量")
    @TableField(exist = false)
    private Integer packQuantity;

    @ApiModelProperty(value = "体积")
    @TableField("volume")
    private BigDecimal volume;

    @ApiModelProperty(value = "商品批次")
    @TableField(exist = false)
    private String extendTwo;


}
